// Car.as - este o masinuta rudimentara - placeholder.
// luata direct din APE/CarDemo - un dreptunghi cu 2 roti
package {
	
	import org.cove.ape.*;
	
	public class Car extends Group {
		
		private var wheelParticleA:WheelParticle;
		private var wheelParticleB:WheelParticle;
		
		
		public function Car(colC:uint, colE:uint,offX:Number=0,offY:Number=0) {
			
			wheelParticleA = new WheelParticle(140+offX,10+offY,14,false);
			wheelParticleA.setStyle(0, colC, 1, colE);
			addParticle(wheelParticleA);
			wheelParticleA.sprite.cacheAsBitmap = true;
			
			wheelParticleB = new WheelParticle(200+offX,10+offY,14,false);
			wheelParticleB.setStyle(0, colC, 1, colE);
			addParticle(wheelParticleB);
			wheelParticleB.sprite.cacheAsBitmap = true;
			
			var wheelConnector:SpringConstraint = new SpringConstraint(wheelParticleA, wheelParticleB,
					0.5, true, 8);
			wheelConnector.setStyle(0, colC, 1, colE);
			addConstraint(wheelConnector);
		}
		
		public function get px():Number {
			return wheelParticleA.center.x;
		}
				
		public function get py():Number {
			return wheelParticleA.center.y;
		}	
		
		public function set speed(s:Number):void {
			wheelParticleA.angularVelocity = s;
			wheelParticleB.angularVelocity = s;
		}
		
	}
}